#ifndef GLWIDGET_H
#define GLWIDGET_H
#include <QtOpenGL/QGLWidget>
#include "samegame.h"
#include <QTimer>
#include <beesolver.h>
class GLWidget : public QGLWidget
{
    Q_OBJECT
public:
    explicit GLWidget(QWidget *parent = 0, int _w=20, int _h=10, int _c=5, int predef=-1);
    GLWidget(QWidget *parent, sameGame *game,SGSolution solution_);
     sameGame *s;
protected:
    void initializeGL();
    void resizeGL(int w, int h);
    void paintGL();
    void mousePressEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void keyPressEvent(QKeyEvent *event);   
    void click(int x,int y) {s->click(x,y);update();step++;}
    QTimer *timer;
    int *copy;
    float colors[10][3];
    float offset;
    SGSolution solution;
    int step,c;
    int *chart;
    int paintColor;
    bool mousePress;
signals:

public slots:
    void tick()
    {

        if(step<solution.steps.size())
        {
            click(solution.steps.at(step).x,solution.steps.at(step).y);
            //step++;
        }

    }
    
};

#endif // GLWIDGET_H
